import Main from '@/layout/Main.vue'
import type { RouteRecordRaw } from 'vue-router'
// meta 参数
/**
 * @param {string} title 标题
 * @param {string} icon 图标
 * @param {string} menu_id 菜单id
 * @param {boolean} hideInMenu 是否隐藏
 * @param {boolean} parent_id 父级id
 */
export type Meta = {
  title: string
  icon: string
  menu_id?: string
  hideInMenu?: boolean
  parent_id?: boolean
}

export type Routers = RouteRecordRaw & {
  meta: Meta
  enable?: boolean
  // 动态添加
  sort?: number
}

declare module 'vue-router' {
  interface RouteMeta extends Meta {
    [s: string]: Meta[keyof Meta]
  }
}
const defaultRoute: Routers[] = [
  {
    path: '/',
    name: 'home',
    redirect: '/home',
    component: Main,
    meta: {
      icon: 'HomeFilled',
      hideInMenu: true,
      title: '首页',
    },
    children: [
      {
        path: '/home',
        name: 'home_page',
        component: () => import('@/views/Home/index.vue'),
        meta: {
          title: '首页',
          icon: 'HomeFilled',
          hideInMenu: true,
        },
      },
    ],
  },
  {
    path: '/login',
    name: 'login',
    meta: {
      title: '登录',
      icon: '',
    },
    component: () => import('@/views/Login/index.vue'),
  },
]

export default defaultRoute
